Skip to content

fix(hooks): adds event name inference to fix missing captures#2478

Merged
jkim323 merged 9 commits into
microsoft:mainfrom
vyta:fix/telemetry-hook
Jul 23, 2026
Merged

fix(hooks): adds event name inference to fix missing captures#2478
jkim323 merged 9 commits into
microsoft:mainfrom
vyta:fix/telemetry-hook

Conversation

@vyta

@vyta vyta commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

  • Adds hooks shared folder to vs code settings
  • Adds cli hook events
  • Updates capture logic to infer event names rather than skip

Related Issue(s)

Fixes #2475

Type of Change

Select all that apply:

Code & Documentation:

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Infrastructure & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with prompt-builder agent and addressed all feedback
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)
  • Copilot hook (.github/hooks/*/*.json)
  • Eval spec added/updated for changed AI artifacts (evals/)

Note for AI Artifact Contributors:

  • Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review .github/agents/ before creating new ones.
  • Skills: Must include both bash and PowerShell scripts. See Skills.
  • Model Versions: Only contributions targeting the latest Anthropic and OpenAI models will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected.
  • See Agents Not Accepted and Model Version Requirements.

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Testing

  • Manual validation of capture
  • Added unit tests

Checklist

Required Checks

  • Documentation is updated (if applicable)
  • Files follow existing naming conventions
  • Changes are backwards compatible (if applicable)
  • Tests added for new functionality (if applicable)

AI Artifact Contributions

  • Used /prompt-analyze to review contribution
  • Addressed all feedback from prompt-builder review
  • Verified contribution follows common standards and type-specific requirements

Required Automated Checks

The following validation commands must pass before merging:

  • Markdown linting: npm run lint:md
  • Spell checking: npm run spell-check
  • Frontmatter validation: npm run lint:frontmatter
  • Skill structure validation: npm run validate:skills
  • Link validation: npm run lint:md-links
  • PowerShell analysis: npm run lint:ps
  • Eval spec schema and coverage (if AI artifacts changed): npm run eval:lint:schema
  • Plugin freshness: npm run plugin:generate
  • Docusaurus tests: npm run docs:test

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues
  • Security-related scripts follow the principle of least privilege

Additional Notes

@vyta
vyta requested a review from a team as a code owner July 17, 2026 18:12
@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.75%. Comparing base (a66a3ce) to head (f25351f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2478      +/-   ##
==========================================
- Coverage   82.75%   82.75%   -0.01%     
==========================================
  Files         154      154              
  Lines       20843    20843              
  Branches       13       13              
==========================================
- Hits        17249    17248       -1     
- Misses       3592     3593       +1     
  Partials        2        2              
Flag Coverage Δ
docusaurus 94.38% <ø> (ø)
pester 86.26% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/linting/Validate-HookManifests.ps1 85.12% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vyta
vyta requested a review from jkim323 July 20, 2026 22:00

@jkim323 jkim323 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Vy for this PR!! Left a couple of comments for you take a look at.

Comment thread .github/hooks/shared/telemetry/_telemetry_core.py
Comment thread scripts/linting/Validate-HookManifests.ps1
Comment thread .github/hooks/shared/telemetry/_telemetry_core.py
@vyta
vyta force-pushed the fix/telemetry-hook branch from f2953ad to 3226ca1 Compare July 22, 2026 19:07
@vyta

vyta commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@jkim323 thanks for the review! ready for another look

@vyta
vyta requested a review from jkim323 July 22, 2026 20:40

@katriendg katriendg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the fix cleanly addresses both halves of #2475 (nested-hook discovery via chat.hookFilesLocations, and CLI event recovery via shape inference), and the test coverage plus the schema/validator/docs sync are excellent. Both test suites pass locally (54 Python, 22 Pester).

A few non-blocking notes:

  • The sessionEnd alias moved from Stop to SessionEnd. Could you confirm the report/aggregation consumers (not in this diff) don't count on event == "Stop" for session-end semantics?
  • Consider documenting the chat.hookFilesLocations requirement for nested hook directories in docs/contributing/hooks.md — it's half the root cause and future contributors would benefit.

Approving with comments — nothing here blocks merge.

🤖 AI-assisted review (code-review). Findings must be independently validated by a qualified human reviewer.

Comment thread .github/hooks/shared/telemetry/_telemetry_core.py
Comment thread .github/hooks/shared/telemetry/_telemetry_core.py
Comment thread .github/hooks/shared/telemetry.json
Comment thread docs/contributing/hooks.md
@jkim323
jkim323 merged commit 3660ce0 into microsoft:main Jul 23, 2026
112 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: hooks aren't automatically registered and cli events missing from capture

5 participants